
def clean_word(w):
    """Given a string, it strips the all prefixed and suffixed
    non-alphabetic characters"""

    s = ""
    for i in range(0,len(w)):
        if w[i].isalpha():
            s = w[i:]
            break

    t,i = "",len(s)-1
    while i>=0:
        if s[i].isalpha():
            t = s[0:i+1]
            break
        i -= 1
    return t
